package com.ebt.m.users;

import android.content.Context;
import android.util.AttributeSet;

import com.ebt.m.commons.buscomponent.listview.BaseListView;
import com.ebt.m.commons.buscomponent.listview.ISectionFactory;
import com.ebt.m.commons.buscomponent.listview.IView;

/**
 * Created by wanglu on 2018/2/7.
 */

public class CardDataContent extends BaseListView<CardDataPresenter> {
    public CardDataContent(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CardDataContent(Context context) {
        super(context);
    }

    public CardDataContent(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected ISectionFactory createViewFactory() {
        return viewType -> {

            if (viewType == CardDataPresenter.TYPE_INTRODUCTION_TAG || viewType == CardDataPresenter.TYPE_HONOUR_TAG ||
                    viewType == CardDataPresenter.TYPE_SERVICE_TAG) {
                return new CardTagView(getContext());
            } else if (viewType == CardDataPresenter.TYPE_INTRODUCTION) {
                return new CardIntroductionView(getContext());
            } else if (viewType == CardDataPresenter.TYPE_HONOUR) {
                return new CardHonourView(getContext());
            } else if (viewType == CardDataPresenter.TYPE_SERVICE) {
                return new CardServiceView(getContext());
            } else if(viewType == CardDataPresenter.TYPE_NORMAL_INFO) {
                return new CardNormalInfoView(getContext());
            }
            return null;
        };
    }

    @Override
    protected CardDataPresenter createPresenter() {
        return new CardDataPresenter(getContext(), this);
    }

    @Override
    public void loadNext() {

    }

    @Override
    public void update(Object... args) {
        super.update(args);
        mPresenter.loadNew();
    }
}
